import QtQuick 1.0
import "../Delegates"

//Timeline系で使用するコンテキストメニュー

Rectangle {
    id: _root
    x: 0
    y: 0
    radius: 5
    gradient: Gradient {
        GradientStop {
            position: 0
            color: "#040240"
        }

        GradientStop {
            position: 1
            color: "#000a16"
        }
    }
    border.width: 2
    border.color: "#6bcbf7"

    property alias model: _list.model
    signal click(int index)

    ListView {
        id: _list
        anchors.fill: parent
        anchors.topMargin: 4
        anchors.leftMargin: 4
        anchors.bottomMargin: 4
        anchors.rightMargin: 4

        delegate: DelegateContext {
            id: _delegate
            itemIndex: _index
            itemTitle: _title

            Component.onCompleted: {
                _root.width = _delegate.width + 10;
                _root.height = _delegate.height * _list.count + 10;
            }

            MouseArea {
                anchors.fill: parent

                onClicked: {
                    click(itemIndex);
                }
            }
        }
    }
}

